#ifndef __LOGGER_HPP__
#define __LOGGER_HPP__
#include "core.hpp"
#include <memory>
#include "vendor/spdlog/spdlog.h"
#include "vendor/spdlog/sinks/stdout_color_sinks.h"
#include "vendor/spdlog/fmt/ostr.h"
//todo: 完善功能，多参数。
class Logger
{
    static std::shared_ptr<spdlog::logger> __coreLogger;
    static std::shared_ptr<spdlog::logger> __clientLogger;

public:
    static void init();

    inline static std::shared_ptr<spdlog::logger> &GetCoreLogger()
    {
        return Logger::__coreLogger;
    }
    inline static std::shared_ptr<spdlog::logger> &GetClientLogger()
    {
        return Logger::__clientLogger;
    }
    static mb enabled;
    static void Log(char const *str);
};

#define CORE_TRACE(...) Logger::GetCoreLogger()->trace(__VA_ARGS__);
#define CORE_INFO(...) Logger::GetCoreLogger()->info(__VA_ARGS__);
#define CORE_WARN(...) Logger::GetCoreLogger()->warn(__VA_ARGS__);
#define CORE_ERROR(...) Logger::GetCoreLogger()->error(__VA_ARGS__);
#define CORE_FATAL(...) Logger::GetCoreLogger()->fatal(__VA_ARGS__);

#define TRACE(...) Logger::GetClientLogger()->trace(__VA_ARGS__);
#define INFO(...) Logger::GetClientLogger()->info(__VA_ARGS__);
#define WARN(...) Logger::GetClientLogger()->warn(__VA_ARGS__);
#define ERROR(...) Logger::GetClientLogger()->error(__VA_ARGS__);
#define FATAL(...) Logger::GetClientLogger()->fatal(__VA_ARGS__);

#endif //__LOGGER_HPP__
